<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // Math对象可以进行复杂的算术运算，用法：Math.方法名(参数)
        // 1.计算绝对值Math.abs(x) x的绝对值
        console.log(Math.abs(100));
        console.log(Math.abs(-300));

        // 2.计算3的5次方 Math.pow(x,y) x的y次方
        console.log(3*3*3*3*3);
        console.log(3**5);
        console.log(Math.pow(3,5));

        //3.四舍五入 Math.round(x)
        console.log(Math.round(0.5));
        console.log(Math.round(6.1));
        console.log(Math.round(9.6));

        //4.向上取整,天花板函数Math.ceil(x)、
        // 向下取整,地板函数Math.floor(x)
        console.log(Math.ceil(2.1));//向上取整,天花板函数，获取大于等于参数的最小整数
        console.log(Math.ceil(7.1));
        console.log(Math.ceil(8));
        console.log(Math.ceil(-7.1));//-7
        console.log(Math.ceil(-9.9));//-9

        console.log(Math.floor(10.9));//10向下取整,地板函数,获取小于等于参数的最大整数
        console.log(Math.floor(9.7));//9
        console.log(Math.floor(4.1));//4
        console.log(Math.floor(7));//7
        console.log(Math.floor(-9.3));//-10
        console.log(Math.floor(-7.2));//-8

        // 5.Math.random()获取一个[0.0,1.0)之间的随机浮点数
        console.log(Math.random());

    </script>
</head>
<body>
    
</body>
</html>